import { HttpException } from '@nestjs/common';

export const fileTypeValidate = (...fileType: string[]) => {
  return (req, file: Express.Multer.File, cb) => {
    if (fileType.some((item) => file.mimetype.includes(item))) {
      cb(null, true);
    } else {
      cb(new HttpException('文件类型不合法', 400));
    }
  };
};
